/* ---------------------------------------------------------------------
   Token system
   Concept: a librarian's / fraud-examiner's desk. Kraft-paper ground,
   deep ink typography, and four "stamp" colors that map directly to
   the four verdict categories the app actually produces — the palette
   is functional, not decorative.
------------------------------------------------------------------- */
:root {
  --paper: #E7E0CC;
  --paper-card: #F1ECDD;
  --paper-deep: #DCD3B9;
  --ink: #1E2B39;
  --ink-soft: #4B5A67;
  --line: #C6BA98;

  --stamp-predatory: #A3392B;
  --stamp-hijacked: #B07C22;
  --stamp-cloned: #6B4A63;
  --stamp-legitimate: #3F6B4C;

  --font-display: 'Source Serif 4', Georgia, serif;
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(rgba(30, 43, 57, 0.035) 1px, transparent 1px);
  background-size: 3px 3px;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------------
   Masthead — styled like a journal cover, not an app hero
------------------------------------------------------------------- */
.masthead {
  padding: 3.5rem 1.5rem 0;
  max-width: 780px;
  margin: 0 auto;
}

.masthead-inner { text-align: left; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
}

.masthead h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.9rem;
  line-height: 1.05;
}

.tagline {
  font-size: 1.02rem;
  color: var(--ink-soft);
  max-width: 58ch;
  margin: 0 0 2.2rem;
}

.masthead-rule {
  height: 3px;
  background: var(--ink);
  position: relative;
}
.masthead-rule::after {
  content: "";
  position: absolute;
  left: 0; top: 6px;
  width: 100%;
  height: 1px;
  background: var(--ink);
}

/* ---------------------------------------------------------------------
   Shared "desk" section shell
------------------------------------------------------------------- */
.desk {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.intake-label {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 2.4rem 0 1rem;
}
.intake-number {
  color: var(--ink);
  font-weight: 500;
}

/* ---------------------------------------------------------------------
   Intake form
------------------------------------------------------------------- */
.intake-form {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  box-shadow: 0 1px 0 var(--line);
}

.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-inline { flex: 1; }

.field-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field input {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
}
.field input:focus { border-color: var(--ink); }

.field-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.field-row .field-inline input { font-family: var(--font-mono); font-size: 0.85rem; }

.verify-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--ink);
  color: var(--paper-card);
  border: none;
  border-radius: 2px;
  padding: 0.75rem 1.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.verify-btn:hover { background: #2C3F52; }
.verify-btn:active { transform: translateY(1px); }
.verify-btn:disabled { opacity: 0.55; cursor: progress; }
.verify-btn-arrow { transition: transform 0.15s ease; }
.verify-btn:hover .verify-btn-arrow { transform: translateX(3px); }

.intake-error {
  margin-top: 0.9rem;
  padding: 0.8rem 1rem;
  background: #F6E3DE;
  border: 1px solid var(--stamp-predatory);
  border-radius: 2px;
  font-size: 0.9rem;
  color: #6E251A;
}

/* ---------------------------------------------------------------------
   Loading state
------------------------------------------------------------------- */
.loading {
  text-align: center;
  padding: 3.5rem 1rem;
}
.loading-mark {
  width: 34px; height: 34px;
  margin: 0 auto 1.1rem;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------
   Dossier / results
------------------------------------------------------------------- */
.dossier-header h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0 0 0.3rem;
}
.dossier-sub {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
  word-break: break-all;
  margin: 0 0 1rem;
}

/* Signature element: the verification stamp */
.stamp-wrap {
  display: flex;
  justify-content: center;
  margin: 1.6rem 0 2rem;
}
.stamp {
  width: 168px; height: 168px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-9deg);
  transition: border-color 0.3s ease, color 0.3s ease;
  border: 3px double var(--ink);
  color: var(--ink);
}
.stamp-ring {
  width: 138px; height: 138px;
  border-radius: 50%;
  border: 1px dashed currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.6rem;
}
.stamp-text {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.35;
}
.stamp.verdict-predatory  { color: var(--stamp-predatory); }
.stamp.verdict-hijacked   { color: var(--stamp-hijacked); }
.stamp.verdict-cloned     { color: var(--stamp-cloned); }
.stamp.verdict-legitimate { color: var(--stamp-legitimate); }

/* Meters */
.meters {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 2rem;
}
.meter-row { display: flex; flex-direction: column; gap: 0.35rem; }
.meter-top {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.meter-cat { text-transform: uppercase; letter-spacing: 0.05em; }
.meter-track {
  height: 10px;
  background: var(--paper-deep);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.meter-fill {
  height: 100%;
  border-radius: 5px 0 0 5px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.meter-fill.predatory  { background: var(--stamp-predatory); }
.meter-fill.hijacked   { background: var(--stamp-hijacked); }
.meter-fill.cloned     { background: var(--stamp-cloned); }
.meter-fill.legitimate { background: var(--stamp-legitimate); }

/* Original link callout */
.original-link {
  background: #E9EFE9;
  border: 1px solid var(--stamp-legitimate);
  border-radius: 2px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.original-link-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #2C4A36;
}
.original-link a {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--stamp-legitimate);
  word-break: break-all;
}
.original-link-confidence {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* Evidence + sources */
.section-heading {
  font-family: var(--font-display);
  font-size: 1.15rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
  margin: 0 0 1rem;
}

.evidence-block, .sources-block, .notes-block { margin-bottom: 2.2rem; }

.evidence-list {
  list-style: none;
  margin: 0; padding: 0;
  counter-reset: evidence;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.evidence-item {
  counter-increment: evidence;
  display: flex;
  gap: 0.8rem;
  padding: 0.75rem 0.9rem;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-soft);
  border-radius: 2px;
  font-size: 0.92rem;
}
.evidence-item::before {
  content: counter(evidence, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  flex-shrink: 0;
  padding-top: 0.1rem;
}
.evidence-item.sev-high    { border-left-color: var(--stamp-predatory); }
.evidence-item.sev-medium  { border-left-color: var(--stamp-hijacked); }
.evidence-item.sev-low     { border-left-color: var(--stamp-cloned); }
.evidence-item.sev-positive{ border-left-color: var(--stamp-legitimate); }
.evidence-item.sev-info    { border-left-color: var(--line); color: var(--ink-soft); }

.evidence-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.5rem;
  color: var(--ink-soft);
}

.sources-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.source-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.7rem;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.source-status {
  flex-shrink: 0;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.source-status.match { color: var(--stamp-legitimate); }
.source-status.mismatch { color: var(--stamp-predatory); }
.source-status.not_found { color: var(--stamp-hijacked); }
.source-status.error { color: var(--ink-soft); }

.notes-list {
  margin: 0; padding-left: 1.1rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.notes-list li { margin-bottom: 0.4rem; }

/* ---------------------------------------------------------------------
   Footer
------------------------------------------------------------------- */
.deskfoot {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  border-top: 1px solid var(--line);
  padding-top: 1.4rem;
}
.deskfoot p {
  font-size: 0.8rem;
  color: var(--ink-soft);
  max-width: 62ch;
}

/* ---------------------------------------------------------------------
   Motion respect + mobile
------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 560px) {
  .masthead { padding-top: 2.4rem; }
  .field-row { flex-direction: column; align-items: stretch; }
  .verify-btn { justify-content: center; }
  .stamp { width: 140px; height: 140px; }
  .stamp-ring { width: 112px; height: 112px; }
}
